componentDidCatch(error, info) This lifecycle method is invoked after an error has been thrown by a descendant component.
error - The error that was thrown.
info - An object with a componentStack key containing information about which component threw the error.
componentDidCatch() is called during the “commit” phase, so side-effects are permitted.
It should be used for things like logging errors: